﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;

namespace AttendanceAccounting.Classes
{
    internal class Student : INotifyPropertyChanged
    {
        private int _id = 0;
        private string _lastName = "";
        private string _firstName = "";
        private string _patronymic = "";
        private bool _net = false;
        private bool _bolezn = false;

        #region Интерфейс INotifyPropertyChanged
        public event PropertyChangedEventHandler? PropertyChanged;

        public void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }
        #endregion

        public int Id
        {
            get { return _id; }
            set
            {
                _id = value;
                NotifyPropertyChanged();
            }
        }
        public string LastName
        {
            get { return _lastName; }
            set
            {
                _lastName = value;
                NotifyPropertyChanged();
            }
        }
        public string FirstName
        {
            get { return _firstName; }
            set
            {
                _firstName = value;
                NotifyPropertyChanged();
            }
        }
        public string Patronymic
        {
            get { return _patronymic; }
            set
            {
                _patronymic = value;
                NotifyPropertyChanged();
            }
        }

        public string FullName
        {
            get
            {
                return $"{LastName} {FirstName} {Patronymic}";
            }
        }

        public bool Net { get => _net; set => _net = value; }
        public bool Bolezn { get => _bolezn; set => _bolezn = value; }

        public Student(int id, string lastname, string firstname, string patronymic="")
        {
            Id = id;
            LastName = lastname;
            FirstName = firstname;
            Patronymic = patronymic;
        }

        

        public override string ToString()
        {
            return $"{LastName} {FirstName} {Patronymic}";
        }
    }
}
